source("dados_regular.R")
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ lubridate 1.9.3     ✔ tibble    3.2.1
## ✔ purrr     1.0.2     ✔ tidyr     1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Loading required package: splines
## 
## Loading required package: gamlss.data
## 
## 
## Attaching package: 'gamlss.data'
## 
## 
## The following object is masked from 'package:datasets':
## 
##     sleep
## 
## 
## Loading required package: gamlss.dist
## 
## Loading required package: nlme
## 
## 
## Attaching package: 'nlme'
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     collapse
## 
## 
## Loading required package: parallel
## 
##  **********   GAMLSS Version 5.4-22  ********** 
## 
## For more on GAMLSS look at https://www.gamlss.com/
## 
## Type gamlssNews() to see new features/changes/bug fixes.
## 
## 
## Loading required package: carData
## 
## 
## Attaching package: 'car'
## 
## 
## The following object is masked from 'package:dplyr':
## 
##     recode
## 
## 
## The following object is masked from 'package:purrr':
## 
##     some
## 
## 
## Loading required package: zoo
## 
## 
## Attaching package: 'zoo'
## 
## 
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
########## Regressão linear ########
######backward regression #######
#Selecão das variáveis para compor o modelo, mas precisa depois fazer os teste de resíduo
modelo_back <- lm(WINP ~ PTS + FGP + PF + PlusMinus, data = dados_regressao)
modelo_back
## 
## Call:
## lm(formula = WINP ~ PTS + FGP + PF + PlusMinus, data = dados_regressao)
## 
## Coefficients:
## (Intercept)          PTS          FGP           PF    PlusMinus  
##   0.4105976   -0.0006542    0.0048736   -0.0032414    0.0304204
coef(modelo_back)
##   (Intercept)           PTS           FGP            PF     PlusMinus 
##  0.4105975914 -0.0006542452  0.0048736395 -0.0032414270  0.0304203770
anova(modelo_back)
## Analysis of Variance Table
## 
## Response: WINP
##            Df Sum Sq Mean Sq F value    Pr(>F)    
## PTS         1 0.9761  0.9761  655.61 < 2.2e-16 ***
## FGP         1 2.8026  2.8026 1882.29 < 2.2e-16 ***
## PF          1 0.2162  0.2162  145.18 < 2.2e-16 ***
## PlusMinus   1 5.5307  5.5307 3714.59 < 2.2e-16 ***
## Residuals 445 0.6626  0.0015                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(modelo_back) #Adjusted R-squared:  0.9344
## 
## Call:
## lm(formula = WINP ~ PTS + FGP + PF + PlusMinus, data = dados_regressao)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.113561 -0.026335  0.002916  0.025377  0.130296 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.4105976  0.0715538   5.738 1.77e-08 ***
## PTS         -0.0006542  0.0003239  -2.020  0.04402 *  
## FGP          0.0048736  0.0016969   2.872  0.00427 ** 
## PF          -0.0032414  0.0013132  -2.468  0.01395 *  
## PlusMinus    0.0304204  0.0004991  60.947  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03859 on 445 degrees of freedom
## Multiple R-squared:  0.935,  Adjusted R-squared:  0.9344 
## F-statistic:  1599 on 4 and 445 DF,  p-value: < 2.2e-16
AIC(modelo_back) #-1645.353
## [1] -1645.353
###Resíduos ###
plot(modelo_back, which = 1)

plot(modelo_back, which = 2)

plot(modelo_back, which = 3)

plot(modelo_back, which = 4)

plot(modelo_back, which = 5)

plot(modelo_back, which = 6)

shapiro.test(modelo_back$residuals) #p-value = 0.2669, normal
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_back$residuals
## W = 0.99576, p-value = 0.2669
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_back) #p-value = 0.1735
## 
##  Durbin-Watson test
## 
## data:  modelo_back
## DW = 1.9193, p-value = 0.1735
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_back$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_back$fitted.values, modelo_back$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_back) #p-value = 0.0006407, heterocedasticidade
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_back
## BP = 19.451, df = 4, p-value = 0.0006407
#QQ Plot
library(hnp)
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## 
## The following object is masked from 'package:patchwork':
## 
##     area
## 
## The following object is masked from 'package:dplyr':
## 
##     select
hnp(modelo_back)
## Gaussian model (lm object)

######## Forward Selection ########
modelo_forw <- lm(formula = WINP ~ PlusMinus + PF + FGP + FGM, data = dados_regressao)
modelo_forw
## 
## Call:
## lm(formula = WINP ~ PlusMinus + PF + FGP + FGM, data = dados_regressao)
## 
## Coefficients:
## (Intercept)    PlusMinus           PF          FGP          FGM  
##    0.401565     0.030261    -0.003478     0.005746    -0.002433
coef(modelo_forw)
##  (Intercept)    PlusMinus           PF          FGP          FGM 
##  0.401564997  0.030260547 -0.003477604  0.005745605 -0.002433190
anova(modelo_forw)
## Analysis of Variance Table
## 
## Response: WINP
##            Df Sum Sq Mean Sq   F value  Pr(>F)    
## PlusMinus   1 9.5032  9.5032 6398.0581 < 2e-16 ***
## PF          1 0.0096  0.0096    6.4381 0.01151 *  
## FGP         1 0.0068  0.0068    4.5541 0.03339 *  
## FGM         1 0.0077  0.0077    5.1648 0.02353 *  
## Residuals 445 0.6610  0.0015                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(modelo_forw) #Adjusted R-squared:  0.9345 
## 
## Call:
## lm(formula = WINP ~ PlusMinus + PF + FGP + FGM, data = dados_regressao)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.113414 -0.024898  0.002528  0.025502  0.129168 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.4015650  0.0718776   5.587 4.04e-08 ***
## PlusMinus    0.0302605  0.0005057  59.834  < 2e-16 ***
## PF          -0.0034776  0.0013110  -2.653  0.00827 ** 
## FGP          0.0057456  0.0018603   3.089  0.00214 ** 
## FGM         -0.0024332  0.0010707  -2.273  0.02353 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03854 on 445 degrees of freedom
## Multiple R-squared:  0.9351, Adjusted R-squared:  0.9345 
## F-statistic:  1604 on 4 and 445 DF,  p-value: < 2.2e-16
### Resíduos ###
plot(modelo_forw, which = 1)

plot(modelo_forw, which = 2) #QQ-plot

plot(modelo_forw, which = 3)

plot(modelo_forw, which = 4)

plot(modelo_forw, which = 5)

plot(modelo_forw, which = 6)

shapiro.test(modelo_forw$residuals) #p-value = 0.2296, não normal
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_forw$residuals
## W = 0.99555, p-value = 0.2296
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_forw) #p-value = 0.195
## 
##  Durbin-Watson test
## 
## data:  modelo_forw
## DW = 1.9266, p-value = 0.195
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_forw$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_forw$fitted.values, modelo_forw$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_forw) #p-value = 0.001575, heterocedasticidade
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_forw
## BP = 17.457, df = 4, p-value = 0.001575
library(hnp)
hnp(modelo_forw)
## Gaussian model (lm object)

########## Regressão beta ########
######## Logito ##########
#Melhor modelo logito é o modelo com `3PP` + PF + PlusMinus que é modelo_beta12_3.
modelo_beta12_3 <- betareg(WINP ~ `3PP` + PF + PlusMinus, data = dados_regressao)
modelo_beta12_3
## 
## Call:
## betareg(formula = WINP ~ `3PP` + PF + PlusMinus, data = dados_regressao)
## 
## Coefficients (mean model with logit link):
## (Intercept)        `3PP`           PF    PlusMinus  
##   -0.065925     0.009085    -0.013016     0.132901  
## 
## Phi coefficients (precision model with identity link):
## (phi)  
## 157.3
summary(modelo_beta12_3) #Pseudo R-squared: 0.9351
## 
## Call:
## betareg(formula = WINP ~ `3PP` + PF + PlusMinus, data = dados_regressao)
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -3.0205 -0.6019  0.0688  0.6351  2.9791 
## 
## Coefficients (mean model with logit link):
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.065925   0.215170  -0.306   0.7593    
## `3PP`        0.009085   0.005205   1.746   0.0809 .  
## PF          -0.013016   0.005661  -2.299   0.0215 *  
## PlusMinus    0.132901   0.002136  62.218   <2e-16 ***
## 
## Phi coefficients (precision model with identity link):
##       Estimate Std. Error z value Pr(>|z|)    
## (phi)   157.29      10.46   15.04   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood: 834.7 on 5 Df
## Pseudo R-squared: 0.9318
## Number of iterations: 12 (BFGS) + 2 (Fisher scoring)
coef(modelo_beta12_3)
##   (Intercept)         `3PP`            PF     PlusMinus         (phi) 
##  -0.065924629   0.009085456  -0.013016005   0.132901031 157.292447304
car::Anova(modelo_beta12_3)
## Analysis of Deviance Table (Type II tests)
## 
## Response: WINP
##           Df     Chisq Pr(>Chisq)    
## `3PP`      1    3.0470    0.08089 .  
## PF         1    5.2864    0.02149 *  
## PlusMinus  1 3871.0668    < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
########Resíduos Logito ###
plot(modelo_beta12_3, which = 1, type = "pearson")

plot(modelo_beta12_3, which = 2, type = "pearson")

plot(modelo_beta12_3, which = 3, type = "pearson")

plot(modelo_beta12_3, which = 4, type = "pearson")

plot(modelo_beta12_3, which = 5, type = "deviance", sub.caption = "")

plot(modelo_beta12_3, which = 1, type = "deviance", sub.caption = "")

shapiro.test(modelo_beta12_3$residuals) #p-value = 0.5895, normal
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_beta12_3$residuals
## W = 0.99475, p-value = 0.1284
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_beta12_3) #p-value = 0.2889
## 
##  Durbin-Watson test
## 
## data:  modelo_beta12_3
## DW = 1.936, p-value = 0.2336
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_beta12_3$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_beta12_3$fitted.values, modelo_beta12_3$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_beta12_3) #p-value = 0.03674, heterocedasticidade
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_beta12_3
## BP = 14.444, df = 3, p-value = 0.002359
######## Loglog ##########
#Melhor modelo de loglog é o modelo modelo_beta21 com STL + PF + PlusMinus;
modelo_beta21 <- betareg(WINP ~ STL + PF + PlusMinus,data = dados_regressao, link = "loglog") #Regressão com todos os dados do modelo
modelo_beta21
## 
## Call:
## betareg(formula = WINP ~ STL + PF + PlusMinus, data = dados_regressao, 
##     link = "loglog")
## 
## Coefficients (mean model with loglog link):
## (Intercept)          STL           PF    PlusMinus  
##    0.596869     0.004795    -0.011997     0.092285  
## 
## Phi coefficients (precision model with identity link):
## (phi)  
## 139.4
summary(modelo_beta21) #Pseudo R-squared: 0.9229
## 
## Call:
## betareg(formula = WINP ~ STL + PF + PlusMinus, data = dados_regressao, 
##     link = "loglog")
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -3.0613 -0.5808  0.0294  0.6645  4.0164 
## 
## Coefficients (mean model with loglog link):
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  0.596869   0.091508   6.523 6.91e-11 ***
## STL          0.004795   0.007444   0.644  0.51949    
## PF          -0.011997   0.004281  -2.802  0.00508 ** 
## PlusMinus    0.092285   0.001316  70.130  < 2e-16 ***
## 
## Phi coefficients (precision model with identity link):
##       Estimate Std. Error z value Pr(>|z|)    
## (phi)  139.407      9.263   15.05   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood: 807.6 on 5 Df
## Pseudo R-squared: 0.9229
## Number of iterations: 28 (BFGS) + 2 (Fisher scoring)
coef(modelo_beta21)
##   (Intercept)           STL            PF     PlusMinus         (phi) 
##   0.596868894   0.004794876  -0.011997188   0.092284526 139.407335668
car::Anova(modelo_beta21)
## Analysis of Deviance Table (Type II tests)
## 
## Response: WINP
##           Df     Chisq Pr(>Chisq)    
## STL        1    0.4149   0.519487    
## PF         1    7.8518   0.005077 ** 
## PlusMinus  1 4918.2225  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### Resíduos loglog ##
plot(modelo_beta21, which = 1, type = "pearson")

plot(modelo_beta21, which = 2, type = "pearson")

plot(modelo_beta21, which = 3, type = "pearson")

plot(modelo_beta21, which = 4, type = "pearson")

plot(modelo_beta21, which = 5, type = "deviance", sub.caption = "")

plot(modelo_beta21, which = 1, type = "deviance", sub.caption = "")

shapiro.test(modelo_beta21$residuals) #p-value = 
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_beta21$residuals
## W = 0.99573, p-value = 0.2618
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_beta21) #p-value = 
## 
##  Durbin-Watson test
## 
## data:  modelo_beta21
## DW = 1.9408, p-value = 0.2497
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_beta21$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_beta21$fitted.values, modelo_beta21$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_beta21) #p-value =
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_beta21
## BP = 15.604, df = 3, p-value = 0.001367
######## Probito ##########
#Melhor modelo de probito é modelo_beta_probit2 com `3PP` + TOV + STL + PF + PlusMinus;
modelo_beta_probit2 <- betareg(WINP ~ `3PP` + TOV + STL + PF + PlusMinus,data = dados_regressao, link = "probit")
modelo_beta_probit2
## 
## Call:
## betareg(formula = WINP ~ `3PP` + TOV + STL + PF + PlusMinus, data = dados_regressao, 
##     link = "probit")
## 
## Coefficients (mean model with probit link):
## (Intercept)        `3PP`          TOV          STL           PF    PlusMinus  
##  -0.0671991    0.0059479    0.0002532    0.0039662   -0.0089563    0.0816533  
## 
## Phi coefficients (precision model with identity link):
## (phi)  
## 156.5
summary(modelo_beta_probit2) #Pseudo R-squared: 0.9331
## 
## Call:
## betareg(formula = WINP ~ `3PP` + TOV + STL + PF + PlusMinus, data = dados_regressao, 
##     link = "probit")
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -3.0562 -0.6143  0.0566  0.6671  3.0617 
## 
## Coefficients (mean model with probit link):
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.0671991  0.1501123  -0.448   0.6544    
## `3PP`        0.0059479  0.0032840   1.811   0.0701 .  
## TOV          0.0002532  0.0049740   0.051   0.9594    
## STL          0.0039662  0.0062975   0.630   0.5288    
## PF          -0.0089563  0.0037562  -2.384   0.0171 *  
## PlusMinus    0.0816533  0.0013798  59.178   <2e-16 ***
## 
## Phi coefficients (precision model with identity link):
##       Estimate Std. Error z value Pr(>|z|)    
## (phi)   156.55      10.41   15.04   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood: 833.6 on 7 Df
## Pseudo R-squared: 0.9331
## Number of iterations: 16 (BFGS) + 2 (Fisher scoring)
coef(modelo_beta_probit2)
##   (Intercept)         `3PP`           TOV           STL            PF 
## -6.719908e-02  5.947906e-03  2.532476e-04  3.966216e-03 -8.956325e-03 
##     PlusMinus         (phi) 
##  8.165333e-02  1.565477e+02
car::Anova(modelo_beta_probit2)
## Analysis of Deviance Table (Type II tests)
## 
## Response: WINP
##           Df     Chisq Pr(>Chisq)    
## `3PP`      1    3.2804    0.07011 .  
## TOV        1    0.0026    0.95939    
## STL        1    0.3967    0.52882    
## PF         1    5.6855    0.01711 *  
## PlusMinus  1 3501.9850    < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
### Resíduos Probito ###
plot(modelo_beta_probit2, which = 1, type = "pearson")

plot(modelo_beta_probit2, which = 2, type = "pearson")

plot(modelo_beta_probit2, which = 3, type = "pearson")

plot(modelo_beta_probit2, which = 4, type = "pearson")

plot(modelo_beta_probit2, which = 5, type = "deviance", sub.caption = "")

plot(modelo_beta_probit2, which = 1, type = "deviance", sub.caption = "")

shapiro.test(modelo_beta_probit2$residuals) #p-value = 
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_beta_probit2$residuals
## W = 0.99481, p-value = 0.1343
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_beta_probit2) #p-value = 
## 
##  Durbin-Watson test
## 
## data:  modelo_beta_probit2
## DW = 1.9345, p-value = 0.2271
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_beta_probit2$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_beta_probit2$fitted.values, modelo_beta_probit2$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_beta_probit2) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_beta_probit2
## BP = 16.05, df = 5, p-value = 0.006702
######## cloglog ##########
#melhor modelo é modelo_beta_cloglog_1 com TOV + PlusMinus
modelo_beta_cloglog_1 <- betareg(WINP ~ TOV + PlusMinus,data = dados_regressao, link = "cloglog")
modelo_beta_cloglog_1
## 
## Call:
## betareg(formula = WINP ~ TOV + PlusMinus, data = dados_regressao, link = "cloglog")
## 
## Coefficients (mean model with cloglog link):
## (Intercept)          TOV    PlusMinus  
##    -0.25436     -0.01003      0.09576  
## 
## Phi coefficients (precision model with identity link):
## (phi)  
## 145.3
summary(modelo_beta_cloglog_1) #Pseudo R-squared: 0.9286
## 
## Call:
## betareg(formula = WINP ~ TOV + PlusMinus, data = dados_regressao, link = "cloglog")
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -3.4529 -0.6312  0.0437  0.6660  2.4878 
## 
## Coefficients (mean model with cloglog link):
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.254364   0.077923  -3.264   0.0011 ** 
## TOV         -0.010035   0.005468  -1.835   0.0665 .  
## PlusMinus    0.095761   0.001350  70.951   <2e-16 ***
## 
## Phi coefficients (precision model with identity link):
##       Estimate Std. Error z value Pr(>|z|)    
## (phi)  145.329      9.658   15.05   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood:   817 on 4 Df
## Pseudo R-squared: 0.9249
## Number of iterations: 18 (BFGS) + 2 (Fisher scoring)
coef(modelo_beta_cloglog_1)
##  (Intercept)          TOV    PlusMinus        (phi) 
##  -0.25436364  -0.01003488   0.09576090 145.32881961
car::Anova(modelo_beta_cloglog_1)
## Analysis of Deviance Table (Type II tests)
## 
## Response: WINP
##           Df     Chisq Pr(>Chisq)    
## TOV        1    3.3684    0.06646 .  
## PlusMinus  1 5034.0170    < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Resíduos cloglog
plot(modelo_beta_cloglog_1, which = 1, type = "pearson")

plot(modelo_beta_cloglog_1, which = 2, type = "pearson")

plot(modelo_beta_cloglog_1, which = 3, type = "pearson")

plot(modelo_beta_cloglog_1, which = 4, type = "pearson")

plot(modelo_beta_cloglog_1, which = 5, type = "deviance", sub.caption = "")

plot(modelo_beta_cloglog_1, which = 1, type = "deviance", sub.caption = "")

shapiro.test(modelo_beta_cloglog_1$residuals) #p-value = 
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_beta_cloglog_1$residuals
## W = 0.99436, p-value = 0.09578
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_beta_cloglog_1) #p-value = 
## 
##  Durbin-Watson test
## 
## data:  modelo_beta_cloglog_1
## DW = 1.9363, p-value = 0.2385
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_beta_cloglog_1$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_beta_cloglog_1$fitted.values, modelo_beta_cloglog_1$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_beta_cloglog_1) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_beta_cloglog_1
## BP = 4.4453, df = 2, p-value = 0.1083
######## cauchito ##########
modelo_beta_cauchit1 <- betareg(WINP ~  PlusMinus,data = dados_regressao, link = "cauchit")
modelo_beta_cauchit1
## 
## Call:
## betareg(formula = WINP ~ PlusMinus, data = dados_regressao, link = "cauchit")
## 
## Coefficients (mean model with cauchit link):
## (Intercept)    PlusMinus  
##   -0.008704     0.117730  
## 
## Phi coefficients (precision model with identity link):
## (phi)  
## 153.3
summary(modelo_beta_cauchit1) #Pseudo R-squared: 0.8985
## 
## Call:
## betareg(formula = WINP ~ PlusMinus, data = dados_regressao, link = "cauchit")
## 
## Standardized weighted residuals 2:
##     Min      1Q  Median      3Q     Max 
## -3.5614 -0.6544  0.0255  0.6347  3.9100 
## 
## Coefficients (mean model with cauchit link):
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -0.008704   0.006924  -1.257    0.209    
## PlusMinus    0.117730   0.001876  62.749   <2e-16 ***
## 
## Phi coefficients (precision model with identity link):
##       Estimate Std. Error z value Pr(>|z|)    
## (phi)   153.27      10.19   15.05   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Type of estimator: ML (maximum likelihood)
## Log-likelihood: 829.1 on 3 Df
## Pseudo R-squared: 0.8985
## Number of iterations: 28 (BFGS) + 2 (Fisher scoring)
coef(modelo_beta_cauchit1)
##   (Intercept)     PlusMinus         (phi) 
##  -0.008704143   0.117730476 153.265171178
car::Anova(modelo_beta_cauchit1)
## Analysis of Deviance Table (Type II tests)
## 
## Response: WINP
##           Df  Chisq Pr(>Chisq)    
## PlusMinus  1 3937.4  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Resíduos
plot(modelo_beta_cauchit1, which = 1, type = "pearson")

plot(modelo_beta_cauchit1, which = 2, type = "pearson")

plot(modelo_beta_cauchit1, which = 3, type = "pearson")

plot(modelo_beta_cauchit1, which = 4, type = "pearson")

plot(modelo_beta_cauchit1, which = 5, type = "deviance", sub.caption = "")

plot(modelo_beta_cauchit1, which = 1, type = "deviance", sub.caption = "")

shapiro.test(modelo_beta_cauchit1$residuals) #p-value = 
## 
##  Shapiro-Wilk normality test
## 
## data:  modelo_beta_cauchit1$residuals
## W = 0.9963, p-value = 0.3833
#Teste de durbin watson para independencia
library(lmtest)
dwtest(modelo_beta_cauchit1) #p-value = 
## 
##  Durbin-Watson test
## 
## data:  modelo_beta_cauchit1
## DW = 1.9507, p-value = 0.2889
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(modelo_beta_cauchit1$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Homocedasticidade
plot(modelo_beta_cauchit1$fitted.values, modelo_beta_cauchit1$residuals, 
     xlab = "Valores Ajustados",
     ylab = "Residuos",
     pch = 19,
     main = "Suposição de homocedasticidade"
)

#Breusch_Pagan para homocedasticdade
bptest(modelo_beta_cauchit1) #p-value =
## 
##  studentized Breusch-Pagan test
## 
## data:  modelo_beta_cauchit1
## BP = 4.3624, df = 1, p-value = 0.03674
########## GAMLSS ########  
######## Forward Beta ##########
gamlss_beta_forw = gamlss(formula = WINP ~ PlusMinus + FGP + PTS + PF, family = BE, data = dados_regressao)
## GAMLSS-RS iteration 1: Global Deviance = -1321.858 
## GAMLSS-RS iteration 2: Global Deviance = -1676.336 
## GAMLSS-RS iteration 3: Global Deviance = -1676.843 
## GAMLSS-RS iteration 4: Global Deviance = -1676.843
gamlss_beta_forw
## 
## Family:  c("BE", "Beta") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ PlusMinus + FGP + PTS + PF,  
##     family = BE, data = dados_regressao) 
## 
## Mu Coefficients:
## (Intercept)    PlusMinus          FGP          PTS           PF  
##   -0.505065     0.131669     0.023267    -0.003065    -0.012155  
## Sigma Coefficients:
## (Intercept)  
##      -2.458  
## 
##  Degrees of Freedom for the fit: 6 Residual Deg. of Freedom   444 
## Global Deviance:     -1676.84 
##             AIC:     -1664.84 
##             SBC:     -1640.19
coef(gamlss_beta_forw)
##  (Intercept)    PlusMinus          FGP          PTS           PF 
## -0.505064513  0.131668749  0.023266609 -0.003064737 -0.012154978
summary(gamlss_beta_forw) #AIC:     -1664.843
## ******************************************************************
## Family:  c("BE", "Beta") 
## 
## Call:  gamlss(formula = WINP ~ PlusMinus + FGP + PTS + PF,  
##     family = BE, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  logit
## Mu Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.505065   0.305547  -1.653  0.09904 .  
## PlusMinus    0.131669   0.002219  59.330  < 2e-16 ***
## FGP          0.023267   0.007249   3.210  0.00143 ** 
## PTS         -0.003065   0.001395  -2.198  0.02849 *  
## PF          -0.012155   0.005639  -2.156  0.03165 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  logit
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.45847    0.03586  -68.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  6
##       Residual Deg. of Freedom:  444 
##                       at cycle:  4 
##  
## Global Deviance:     -1676.843 
##             AIC:     -1664.843 
##             SBC:     -1640.188 
## ******************************************************************
##### Resíduos ###
plot(gamlss_beta_forw)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  0.003493076 
##                        variance   =  1.002508 
##                coef. of skewness  =  -0.1366816 
##                coef. of kurtosis  =  3.200036 
## Filliben correlation coefficient  =  0.9980074 
## ******************************************************************
shapiro.test(gamlss_beta_forw$residuals) #p-value = 0.2853, normal
## 
##  Shapiro-Wilk normality test
## 
## data:  gamlss_beta_forw$residuals
## W = 0.99586, p-value = 0.2853
#Teste de durbin watson para independencia
library(lmtest)
dwtest(gamlss_beta_forw) #p-value = 0.1735
## 
##  Durbin-Watson test
## 
## data:  gamlss_beta_forw
## DW = 1.9193, p-value = 0.1735
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(gamlss_beta_forw$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(gamlss_beta_forw) #p-value = 0.0006407
## 
##  studentized Breusch-Pagan test
## 
## data:  gamlss_beta_forw
## BP = 19.451, df = 4, p-value = 0.0006407
######## Forward Normal ##########
#Mesma que a linear então não iremos utilizar
gamlss_normal_forw <- gamlss(formula = WINP ~ PlusMinus + PF + FGP + FGM, family = NO, data = dados_regressao) 
## GAMLSS-RS iteration 1: Global Deviance = -1658.44 
## GAMLSS-RS iteration 2: Global Deviance = -1658.44
gamlss_normal_forw
## 
## Family:  c("NO", "Normal") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ PlusMinus + PF + FGP + FGM,  
##     family = NO, data = dados_regressao) 
## 
## Mu Coefficients:
## (Intercept)    PlusMinus           PF          FGP          FGM  
##    0.401565     0.030261    -0.003478     0.005746    -0.002433  
## Sigma Coefficients:
## (Intercept)  
##      -3.262  
## 
##  Degrees of Freedom for the fit: 6 Residual Deg. of Freedom   444 
## Global Deviance:     -1658.44 
##             AIC:     -1646.44 
##             SBC:     -1621.78
coef(gamlss_normal_forw)
##  (Intercept)    PlusMinus           PF          FGP          FGM 
##  0.401564997  0.030260547 -0.003477604  0.005745605 -0.002433190
summary(gamlss_normal_forw) #-1646.44
## ******************************************************************
## Family:  c("NO", "Normal") 
## 
## Call:  gamlss(formula = WINP ~ PlusMinus + PF + FGP + FGM,  
##     family = NO, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  identity
## Mu Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.4015650  0.0714772   5.618 3.41e-08 ***
## PlusMinus    0.0302605  0.0005029  60.170  < 2e-16 ***
## PF          -0.0034776  0.0013037  -2.667  0.00792 ** 
## FGP          0.0057456  0.0018499   3.106  0.00202 ** 
## FGM         -0.0024332  0.0010647  -2.285  0.02276 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  log
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.26165    0.03333  -97.85   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  6
##       Residual Deg. of Freedom:  444 
##                       at cycle:  2 
##  
## Global Deviance:     -1658.44 
##             AIC:     -1646.44 
##             SBC:     -1621.784 
## ******************************************************************
#Resíduos forw
plot(gamlss_normal_forw)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  -5.234287e-19 
##                        variance   =  1.002227 
##                coef. of skewness  =  -0.1543876 
##                coef. of kurtosis  =  3.054637 
## Filliben correlation coefficient  =  0.9977486 
## ******************************************************************
shapiro.test(gamlss_normal_forw$residuals) #p-value = 0.2296, normal
## 
##  Shapiro-Wilk normality test
## 
## data:  gamlss_normal_forw$residuals
## W = 0.99555, p-value = 0.2296
#Teste de durbin watson para independencia
library(lmtest)
dwtest(gamlss_normal_forw) #p-value =  0.195
## 
##  Durbin-Watson test
## 
## data:  gamlss_normal_forw
## DW = 1.9266, p-value = 0.195
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(gamlss_normal_forw$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(gamlss_normal_forw) #p-value = 0.001575
## 
##  studentized Breusch-Pagan test
## 
## data:  gamlss_normal_forw
## BP = 17.457, df = 4, p-value = 0.001575
######## Backward Normal ##########
#Mesma que a linear então não iremos utilizar
gamlss_normal_back <- gamlss(formula = WINP ~ PTS + FGP + PF + PlusMinus, family = NO, data = dados_regressao) 
## GAMLSS-RS iteration 1: Global Deviance = -1657.353 
## GAMLSS-RS iteration 2: Global Deviance = -1657.353
gamlss_normal_back
## 
## Family:  c("NO", "Normal") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ PTS + FGP + PF + PlusMinus,  
##     family = NO, data = dados_regressao) 
## 
## Mu Coefficients:
## (Intercept)          PTS          FGP           PF    PlusMinus  
##   0.4105976   -0.0006542    0.0048736   -0.0032414    0.0304204  
## Sigma Coefficients:
## (Intercept)  
##       -3.26  
## 
##  Degrees of Freedom for the fit: 6 Residual Deg. of Freedom   444 
## Global Deviance:     -1657.35 
##             AIC:     -1645.35 
##             SBC:     -1620.7
coef(gamlss_normal_back)
##   (Intercept)           PTS           FGP            PF     PlusMinus 
##  0.4105975914 -0.0006542452  0.0048736395 -0.0032414270  0.0304203770
summary(gamlss_normal_back) #AIC:     -1645.353 
## ******************************************************************
## Family:  c("NO", "Normal") 
## 
## Call:  gamlss(formula = WINP ~ PTS + FGP + PF + PlusMinus,  
##     family = NO, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  identity
## Mu Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.4105976  0.0711551   5.770 1.49e-08 ***
## PTS         -0.0006542  0.0003221  -2.031  0.04285 *  
## FGP          0.0048736  0.0016875   2.888  0.00406 ** 
## PF          -0.0032414  0.0013059  -2.482  0.01343 *  
## PlusMinus    0.0304204  0.0004963  61.289  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  log
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.26044    0.03333  -97.81   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  6
##       Residual Deg. of Freedom:  444 
##                       at cycle:  2 
##  
## Global Deviance:     -1657.353 
##             AIC:     -1645.353 
##             SBC:     -1620.698 
## ******************************************************************
#Resíduos
plot(gamlss_normal_back)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  -6.457791e-17 
##                        variance   =  1.002227 
##                coef. of skewness  =  -0.1456677 
##                coef. of kurtosis  =  3.071416 
## Filliben correlation coefficient  =  0.9978431 
## ******************************************************************
shapiro.test(gamlss_normal_back$residuals) #p-value = 0.2669, normal
## 
##  Shapiro-Wilk normality test
## 
## data:  gamlss_normal_back$residuals
## W = 0.99576, p-value = 0.2669
#Teste de durbin watson para independencia
library(lmtest)
dwtest(gamlss_normal_back) #p-value = 0.1735
## 
##  Durbin-Watson test
## 
## data:  gamlss_normal_back
## DW = 1.9193, p-value = 0.1735
## alternative hypothesis: true autocorrelation is greater than 0
#Independência
plot(gamlss_normal_back$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(gamlss_normal_back) #p-value = 0.0006407
## 
##  studentized Breusch-Pagan test
## 
## data:  gamlss_normal_back
## BP = 19.451, df = 4, p-value = 0.0006407
########## Modelos Mistos ######## 
##### Normal TEAM #####
misto_normal_team <- gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
                             PlusMinus + OREB + PF + `3PA`, family = NO, data = dados_regressao)
## GAMLSS-RS iteration 1: Global Deviance = -1692.952 
## GAMLSS-RS iteration 2: Global Deviance = -1692.953
misto_normal_team
## 
## Family:  c("NO", "Normal") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
##     PlusMinus + OREB + PF + `3PA`, family = NO, data = dados_regressao) 
## 
## Mu Coefficients:
##            (Intercept)  re(random = ~1 | TEAM)               PlusMinus  
##              0.6092070                      NA               0.0309516  
##                   OREB                      PF                   `3PA`  
##             -0.0039632              -0.0027516              -0.0004534  
## Sigma Coefficients:
## (Intercept)  
##        -3.3  
## 
##  Degrees of Freedom for the fit: 18.68 Residual Deg. of Freedom   431.3 
## Global Deviance:     -1692.95 
##             AIC:     -1655.59 
##             SBC:     -1578.82
coef(misto_normal_team)
##            (Intercept) re(random = ~1 | TEAM)              PlusMinus 
##            0.609207002                     NA            0.030951603 
##                   OREB                     PF                  `3PA` 
##           -0.003963203           -0.002751593           -0.000453441
summary(misto_normal_team) #AIC:
## ******************************************************************
## Family:  c("NO", "Normal") 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
##     PlusMinus + OREB + PF + `3PA`, family = NO, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  identity
## Mu Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.6092070  0.0303785  20.054   <2e-16 ***
## PlusMinus    0.0309516  0.0003838  80.651   <2e-16 ***
## OREB        -0.0039632  0.0015319  -2.587   0.0100 *  
## PF          -0.0027516  0.0012698  -2.167   0.0308 *  
## `3PA`       -0.0004534  0.0002449  -1.852   0.0648 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  log
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.30000    0.03333     -99   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## NOTE: Additive smoothing terms exist in the formulas: 
##  i) Std. Error for smoothers are for the linear effect only. 
## ii) Std. Error for the linear terms maybe are not accurate. 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  18.68251
##       Residual Deg. of Freedom:  431.3175 
##                       at cycle:  2 
##  
## Global Deviance:     -1692.953 
##             AIC:     -1655.588 
##             SBC:     -1578.817 
## ******************************************************************
getSmo(misto_normal_team)
## Linear mixed-effects model fit by maximum likelihood
##   Data: Data 
##   Log-likelihood: 830.6558
##   Fixed: fix.formula 
##   (Intercept) 
## -7.716467e-05 
## 
## Random effects:
##  Formula: ~1 | TEAM
##         (Intercept) Residual
## StdDev: 0.008588527 1.015556
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~W.var 
## Number of Observations: 450
## Number of Groups: 34
#Resíduos
plot(misto_normal_team)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  3.759596e-16 
##                        variance   =  1.002227 
##                coef. of skewness  =  -0.16376 
##                coef. of kurtosis  =  3.164814 
## Filliben correlation coefficient  =  0.9976843 
## ******************************************************************
shapiro.test(misto_normal_team$residuals) #p-value =  normal
## 
##  Shapiro-Wilk normality test
## 
## data:  misto_normal_team$residuals
## W = 0.99567, p-value = 0.2499
#Independência
plot(misto_normal_team$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(misto_normal_team) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  misto_normal_team
## BP = 19.427, df = 4, p-value = 0.0006477
###### Forward Normal Temporada #####
misto_normal_forw_temp <- gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
                                   PlusMinus + PF + FGP + FGM, family = NO, data = dados_regressao)
## GAMLSS-RS iteration 1: Global Deviance = -1658.44 
## GAMLSS-RS iteration 2: Global Deviance = -1658.44
misto_normal_forw_temp
## 
## Family:  c("NO", "Normal") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
##     PlusMinus + PF + FGP + FGM, family = NO, data = dados_regressao) 
## 
## Mu Coefficients:
##                        (Intercept)  re(random = ~1 | Numero_temporada)  
##                           0.401565                                  NA  
##                          PlusMinus                                  PF  
##                           0.030261                           -0.003478  
##                                FGP                                 FGM  
##                           0.005746                           -0.002433  
## Sigma Coefficients:
## (Intercept)  
##      -3.262  
## 
##  Degrees of Freedom for the fit: 5 Residual Deg. of Freedom   445 
## Global Deviance:     -1658.44 
##             AIC:     -1648.44 
##             SBC:     -1627.89
coef(misto_normal_forw_temp)
##                        (Intercept) re(random = ~1 | Numero_temporada) 
##                        0.401564997                                 NA 
##                          PlusMinus                                 PF 
##                        0.030260547                       -0.003477604 
##                                FGP                                FGM 
##                        0.005745605                       -0.002433190
summary(misto_normal_forw_temp) #AIC:
## ******************************************************************
## Family:  c("NO", "Normal") 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
##     PlusMinus + PF + FGP + FGM, family = NO, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  identity
## Mu Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.4015650  0.0714772   5.618 3.41e-08 ***
## PlusMinus    0.0302605  0.0005029  60.170  < 2e-16 ***
## PF          -0.0034776  0.0013037  -2.667  0.00792 ** 
## FGP          0.0057456  0.0018499   3.106  0.00202 ** 
## FGM         -0.0024332  0.0010647  -2.285  0.02276 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  log
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.26165    0.03333  -97.85   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## NOTE: Additive smoothing terms exist in the formulas: 
##  i) Std. Error for smoothers are for the linear effect only. 
## ii) Std. Error for the linear terms maybe are not accurate. 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  5
##       Residual Deg. of Freedom:  445 
##                       at cycle:  2 
##  
## Global Deviance:     -1658.44 
##             AIC:     -1648.44 
##             SBC:     -1627.894 
## ******************************************************************
getSmo(misto_normal_forw_temp)
## Linear mixed-effects model fit by maximum likelihood
##   Data: Data 
##   Log-likelihood: 829.22
##   Fixed: fix.formula 
##   (Intercept) 
## -2.406961e-18 
## 
## Random effects:
##  Formula: ~1 | Numero_temporada
##          (Intercept)  Residual
## StdDev: 2.425336e-07 0.9999995
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~W.var 
## Number of Observations: 450
## Number of Groups: 15
#Resíduos
plot(misto_normal_forw_temp)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  -2.760282e-16 
##                        variance   =  1.002227 
##                coef. of skewness  =  -0.1543876 
##                coef. of kurtosis  =  3.054637 
## Filliben correlation coefficient  =  0.9977486 
## ******************************************************************
shapiro.test(misto_normal_forw_temp$residuals) #p-value =  normal
## 
##  Shapiro-Wilk normality test
## 
## data:  misto_normal_forw_temp$residuals
## W = 0.99555, p-value = 0.2296
#Independência
plot(misto_normal_forw_temp$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(misto_normal_forw_temp) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  misto_normal_forw_temp
## BP = 17.457, df = 4, p-value = 0.001575
###### Beta Team ####
misto_beta_forw_team <- gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
                            PlusMinus + FGP + PTS + PF, family = BE, data = dados_regressao) 
## GAMLSS-RS iteration 1: Global Deviance = -1331.692 
## GAMLSS-RS iteration 2: Global Deviance = -1702.507 
## GAMLSS-RS iteration 3: Global Deviance = -1703.008 
## GAMLSS-RS iteration 4: Global Deviance = -1702.989 
## GAMLSS-RS iteration 5: Global Deviance = -1702.988
misto_beta_forw_team
## 
## Family:  c("BE", "Beta") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
##     PlusMinus + FGP + PTS + PF, family = BE, data = dados_regressao) 
## 
## Mu Coefficients:
##            (Intercept)  re(random = ~1 | TEAM)               PlusMinus  
##               -0.52046                      NA                 0.13127  
##                    FGP                     PTS                      PF  
##                0.02313                -0.00305                -0.01114  
## Sigma Coefficients:
## (Intercept)  
##       -2.49  
## 
##  Degrees of Freedom for the fit: 15.52 Residual Deg. of Freedom   434.5 
## Global Deviance:     -1702.99 
##             AIC:     -1671.94 
##             SBC:     -1608.14
coef(misto_beta_forw_team)
##            (Intercept) re(random = ~1 | TEAM)              PlusMinus 
##           -0.520457363                     NA            0.131270482 
##                    FGP                    PTS                     PF 
##            0.023125273           -0.003050261           -0.011143861
summary(misto_beta_forw_team) #AIC:
## ******************************************************************
## Family:  c("BE", "Beta") 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | TEAM)) +  
##     PlusMinus + FGP + PTS + PF, family = BE, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  logit
## Mu Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.520457   0.296861  -1.753  0.08027 .  
## PlusMinus    0.131270   0.002155  60.912  < 2e-16 ***
## FGP          0.023125   0.007044   3.283  0.00111 ** 
## PTS         -0.003050   0.001355  -2.251  0.02490 *  
## PF          -0.011144   0.005475  -2.035  0.04243 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  logit
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.48957    0.03579  -69.56   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## NOTE: Additive smoothing terms exist in the formulas: 
##  i) Std. Error for smoothers are for the linear effect only. 
## ii) Std. Error for the linear terms maybe are not accurate. 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  15.52489
##       Residual Deg. of Freedom:  434.4751 
##                       at cycle:  5 
##  
## Global Deviance:     -1702.988 
##             AIC:     -1671.938 
##             SBC:     -1608.143 
## ******************************************************************
getSmo(misto_beta_forw_team)
## Linear mixed-effects model fit by maximum likelihood
##   Data: Data 
##   Log-likelihood: 172.8376
##   Fixed: fix.formula 
##  (Intercept) 
## -0.000240694 
## 
## Random effects:
##  Formula: ~1 | TEAM
##         (Intercept) Residual
## StdDev:  0.03017841 1.011871
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~W.var 
## Number of Observations: 450
## Number of Groups: 34
#Resíduos
plot(misto_beta_forw_team)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  0.003213294 
##                        variance   =  1.002233 
##                coef. of skewness  =  -0.1191569 
##                coef. of kurtosis  =  3.196833 
## Filliben correlation coefficient  =  0.9981705 
## ******************************************************************
shapiro.test(misto_beta_forw_team$residuals) #p-value =  normal
## 
##  Shapiro-Wilk normality test
## 
## data:  misto_beta_forw_team$residuals
## W = 0.99621, p-value = 0.3609
#Independência
plot(misto_beta_forw_team$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(misto_beta_forw_team) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  misto_beta_forw_team
## BP = 19.451, df = 4, p-value = 0.0006407
##### Backward Beta Temporada #####
misto_beta_temp <- gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
         PlusMinus + PF + FGP + FGA, family = BE, data = dados_regressao) 
## GAMLSS-RS iteration 1: Global Deviance = -1321.864 
## GAMLSS-RS iteration 2: Global Deviance = -1676.074 
## GAMLSS-RS iteration 3: Global Deviance = -1676.579 
## GAMLSS-RS iteration 4: Global Deviance = -1676.579
misto_beta_temp
## 
## Family:  c("BE", "Beta") 
## Fitting method: RS() 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
##     PlusMinus + PF + FGP + FGA, family = BE, data = dados_regressao) 
## 
## Mu Coefficients:
##                        (Intercept)  re(random = ~1 | Numero_temporada)  
##                          -0.144351                                  NA  
##                          PlusMinus                                  PF  
##                           0.131028                           -0.013171  
##                                FGP                                 FGA  
##                           0.017272                           -0.004551  
## Sigma Coefficients:
## (Intercept)  
##      -2.458  
## 
##  Degrees of Freedom for the fit: 5 Residual Deg. of Freedom   445 
## Global Deviance:     -1676.58 
##             AIC:     -1666.58 
##             SBC:     -1646.03
coef(misto_beta_temp)
##                        (Intercept) re(random = ~1 | Numero_temporada) 
##                       -0.144351152                                 NA 
##                          PlusMinus                                 PF 
##                        0.131028037                       -0.013171238 
##                                FGP                                FGA 
##                        0.017272427                       -0.004550627
summary(misto_beta_temp) #AIC:
## ******************************************************************
## Family:  c("BE", "Beta") 
## 
## Call:  gamlss(formula = WINP ~ (re(random = ~1 | Numero_temporada)) +  
##     PlusMinus + PF + FGP + FGA, family = BE, data = dados_regressao) 
## 
## Fitting method: RS() 
## 
## ------------------------------------------------------------------
## Mu link function:  logit
## Mu Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -0.144351   0.330670  -0.437  0.66266    
## PlusMinus    0.131028   0.002248  58.298  < 2e-16 ***
## PF          -0.013171   0.005636  -2.337  0.01987 *  
## FGP          0.017272   0.006264   2.757  0.00607 ** 
## FGA         -0.004551   0.002125  -2.141  0.03280 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## Sigma link function:  logit
## Sigma Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.45814    0.03586  -68.55   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------
## NOTE: Additive smoothing terms exist in the formulas: 
##  i) Std. Error for smoothers are for the linear effect only. 
## ii) Std. Error for the linear terms maybe are not accurate. 
## ------------------------------------------------------------------
## No. of observations in the fit:  450 
## Degrees of Freedom for the fit:  5
##       Residual Deg. of Freedom:  445 
##                       at cycle:  4 
##  
## Global Deviance:     -1676.579 
##             AIC:     -1666.579 
##             SBC:     -1646.033 
## ******************************************************************
getSmo(misto_beta_temp)
## Linear mixed-effects model fit by maximum likelihood
##   Data: Data 
##   Log-likelihood: 171.5918
##   Fixed: fix.formula 
##  (Intercept) 
## 2.707631e-13 
## 
## Random effects:
##  Formula: ~1 | Numero_temporada
##          (Intercept)  Residual
## StdDev: 3.331254e-06 0.9997892
## 
## Variance function:
##  Structure: fixed weights
##  Formula: ~W.var 
## Number of Observations: 450
## Number of Groups: 15
#Resíduos
plot(misto_beta_temp)

## ******************************************************************
##        Summary of the Quantile Residuals
##                            mean   =  0.003259703 
##                        variance   =  1.002493 
##                coef. of skewness  =  -0.1504399 
##                coef. of kurtosis  =  3.186479 
## Filliben correlation coefficient  =  0.9977991 
## ******************************************************************
shapiro.test(misto_beta_temp$residuals) #p-value =  normal
## 
##  Shapiro-Wilk normality test
## 
## data:  misto_beta_temp$residuals
## W = 0.99535, p-value = 0.2
#Independência
plot(misto_beta_temp$residuals,
     ylab = "Residuos",
     xlab = "Index dos Imovéis", 
     main = "Suposição de independência",
     pch = 19)

#Breusch_Pagan para homocedasticdade
bptest(misto_beta_temp) #p-value = 
## 
##  studentized Breusch-Pagan test
## 
## data:  misto_beta_temp
## BP = 17.534, df = 4, p-value = 0.001522